﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UIManager : Singleton<UIManager> {

    Dictionary<PanelType, Transform> m_dictPanelRoot = null;
    Dictionary<int, UIPanel> m_dictpanels = null;
    Dictionary<int, UIPanel> m_dictShowpanels = null;
    private List<int> m_lstrecycle = null;
    //面板最后一次关闭到现在的时间
    private Dictionary<int, float> m_dicPanelLastHideTime = null;
    private List<int> m_lstCache = new List<int>();
    private List<int> m_lstLoadingPanel = new List<int>();

    public override void Initialize()
    {
        base.Initialize();
        GameObject uiroot = GameObject.FindGameObjectWithTag("UI_Root");
        if (uiroot == null)
        {
            Debug.LogError("Can't find uiroot");
            return;
        }

        m_dictpanels = new Dictionary<int, UIPanel>();
        m_dictShowpanels = new Dictionary<int, UIPanel>();
        m_lstrecycle = new List<int>();
        m_dicPanelLastHideTime = new Dictionary<int, float>();
        m_dictPanelRoot = new Dictionary<PanelType, Transform>();
        Transform PanelRoot = uiroot.transform.Find("PanelRoot");
        m_dictPanelRoot.Add(PanelType.Normal, PanelRoot.Find("PanelRoot/Normal"));
        m_dictPanelRoot.Add(PanelType.TopBar, PanelRoot.Find("PanelRoot/TopBar"));
        m_dictPanelRoot.Add(PanelType.Pop, PanelRoot.Find("PanelRoot/Pop"));
        m_dictPanelRoot.Add(PanelType.Tip, PanelRoot.Find("PanelRoot/Tip"));
    }

}
